include("MineralCost.lua")

local EnergyCost  = 10
local GasCost		= 100
local HeavyWater	= 1250
local WaterCost	= 10
--Cost multipliers
local GeneMulti		= 0.5
local StorageMulti  = 1
local EnvironMulti	= 1
local SpecialMulti	= 1
local ResDistMulti	= 1
local MiningMulti	= 1


function GetPropPrice(Volume, Mass)
	local Price
	Price = math.ceil(Volume / 500)
	return Price
end


-- SM.RegisterResourceData( <<Value pr 1000>> , <<valuepr1>> , <<Resource Name>> , <<Resource Group>> , [[<<type ("easy","medium","hard","tough")>>]] )

function RegisterResData()

	local SM = CAF.GetAddon("Selling Machine")
	-- Generator resources
	SM.RegisterResourceData( EnergyCost, 0, 	"energy", 			"natural", "easy" )
	SM.RegisterResourceData( GasCost, 0, 		"oxygen", 			"gas", "easy" )
	SM.RegisterResourceData( GasCost, 0, 		"hydrogen", 		"gas", "easy" )
	SM.RegisterResourceData( GasCost, 0, 		"nitrogen", 		"gas", "easy" )
	SM.RegisterResourceData( GasCost, 0, 		"carbon dioxide", 	"gas", "easy" )
	SM.RegisterResourceData( WaterCost, 0, 		"water", 			"gas", "easy" )
	SM.RegisterResourceData( HeavyWater, 0, 	"heavy water", 		"gas", "easy" )
	
	-- Mineral resources
	SM.RegisterResourceData( 0, MineralValue("Ice"), 		"Refined Ice", 			"Mineral", "easy" )
	SM.RegisterResourceData( 0, MineralValue("Iron"), 		"Refined Iron", 		"Mineral", "easy" )
	SM.RegisterResourceData( 0, MineralValue("Aluminum"), 	"Refined Aluminum", 	"Mineral", "medium" )
	SM.RegisterResourceData( 0, MineralValue("Copper"), 	"Refined Copper", 		"Mineral", "medium" )
	SM.RegisterResourceData( 0, MineralValue("Uranium"), 	"Refined Uranium", 		"Mineral", "medium" )
	SM.RegisterResourceData( 0, MineralValue("Titanium"), 	"Refined Titanium", 	"Mineral", "medium" )
	SM.RegisterResourceData( 0, MineralValue("Lithium"), 	"Refined Lithium", 		"Mineral", "hard" )
	SM.RegisterResourceData( 0, MineralValue("Chromite"), 	"Refined Chromite", 	"Mineral", "hard" )
	SM.RegisterResourceData( 0, MineralValue("Plutonium"), 	"Refined Plutonium", 	"Mineral", "hard" )
	SM.RegisterResourceData( 0, MineralValue("Platinum"), 	"Refined Platinum", 	"Mineral", "tough" )
	SM.RegisterResourceData( 0, MineralValue("Mercury"), 	"Refined Mercury", 		"Mineral", "tough" )
	SM.RegisterResourceData( 0, MineralValue("Obsidian"), 	"Refined Obsidian", 	"Mineral", "tough" )
	SM.RegisterResourceData( 0, MineralValue("Silver"), 	"Refined Silver", 		"Mineral", "tough" )
	SM.RegisterResourceData( 0, MineralValue("Gold"), 		"Refined Gold", 		"Mineral", "tough" )
	SM.RegisterResourceData( 0, MineralValue("Irdirium"), 	"Refined Irdirium", 	"Mineral", "tough" )
end


hook.Add( "Initialize", "MyRegisterResData", RegisterResData )


function GetPrice (DeviceType, DeviceModel)
	local Price = 0
	
	--MsgN("GetPrice Type: "..DeviceType)
	--MsgN("GetPrice Model: "..DeviceModel)

	if (DeviceType == "g_mining_drill" and DeviceModel == "models/props_mining/antlion_detector.mdl") then
		Price = 30000
	end
	if (DeviceType == "survey_probe" and DeviceModel == "models/props_combine/combine_mine01.mdl") then
		Price = 5000
	end

	-- =================================================================================================================================== --
	-- ========================================================GENERATOR=START============================================================ --
	-- =================================================================================================================================== --
	
	--Fusion generators
	if(DeviceType == "generator_energy_fusion") then
		if(DeviceModel == "models/ce_ls3additional/fusion_generator/fusion_generator_small.mdl") then
			Price = (EnergyCost * 16000) * GeneMulti		--140min
		elseif(DeviceModel == "models/ce_ls3additional/fusion_generator/fusion_generator_medium.mdl") then
			Price = (EnergyCost * 220000) * GeneMulti		--110min
		elseif(DeviceModel == "models/ce_ls3additional/fusion_generator/fusion_generator_large.mdl") then
			Price = (EnergyCost * 200000) * GeneMulti		--120min
		elseif(DeviceModel == "models/ce_ls3additional/fusion_generator/fusion_generator_huge.mdl") then
			Price = (EnergyCost * 1000000) * GeneMulti		--100min
		elseif(DeviceModel == "models/SmallBridge/Life Support/SBfusiongen.mdl") then
			Price = (EnergyCost * 60000) * GeneMulti		--120min
		end
	end
	
	--Gas (o2, co2, h, n)
	if(DeviceType == "generator_gas_o2" 
	or DeviceType == "generator_gas_co2" 
	or DeviceType == "generator_gas_h" 
	or DeviceType == "generator_gas_n" 
	or "generator_gas") then
	
		if(DeviceModel == "models/ce_ls3additional/compressor/compressor.mdl") then
			Price = (GasCost * 5) * GeneMulti  --80min
		elseif(DeviceModel == "models/ce_ls3additional/compressor/compressor_large.mdl") then
			Price = (GasCost * 300) * GeneMulti --70min
		elseif(DeviceModel == "models/ce_ls3additional/compressor/compressor_huge.mdl") then
			Price = (GasCost * 400) * GeneMulti --50min
		elseif(DeviceModel == "models/chipstiks_ls3_models/OxygenCompressor/oxygencompressor.mdl" 
		or DeviceModel == "models/chipstiks_ls3_models/CO2Comp/co2comp.mdl"
		or DeviceModel == "models/chipstiks_ls3_models/HydrogenCompressor/hydrogencompressor.mdl"
		or DeviceModel == "models/chipstiks_ls3_models/NitrogenCompressor/nitrogencompressor.mdl") then
			Price = (GasCost * 360) * GeneMulti --60min
		end
	end
	
	--H20 Splitters
	if(DeviceType == "generator_gas_o2h_water") then
		if(DeviceModel == "models/LifeSupport/Generators/waterairextractor.mdl"
		or DeviceModel == "models/lifesupport/generators/waterairextractor.mdl") then
			Price = (GasCost * 570) * GeneMulti --60min
		elseif(DeviceModel == "models/ce_ls3additional/water_air_extractor/water_air_extractor.mdl") then
			Price = (GasCost * 360) * GeneMulti --60min
		end
	end
	
	--Heavy water generator
	if(DeviceType == "generator_liquid_hvywater") then
		if(DeviceModel == "models/props_wasteland/laundry_washer003.mdl") then
			Price = (HeavyWater * 12) * GeneMulti --60min
		end
	end
	
	--Hydro Energy Generator
	if(DeviceType == "generator_energy_hydro") then
		if(DeviceModel == "models/chipstiks_ls3_models/HydroGenerator/hydrogenerator.mdl"
		or DeviceModel == "models/chipstiks_ls3_models/hydrogenerator/hydrogenerator.mdl") then
			Price = (720 * EnergyCost) * GeneMulti --120min
		end
	end
	
	--Hydro Fuel Cell
	if(DeviceType == "generator_liquid_water2") then
		if(DeviceModel == "models/LifeSupport/Generators/waterairextractor.mdl"
		or DeviceModel == "models/lifesupport/generators/waterairextractor.mdl") then
			Price = (700 * WaterCost) * GeneMulti --60min
		end
	end
	
	--Solar Panels
	if(DeviceType == "generator_energy_solar") then
	--PHX
		if(DeviceModel == "models/props_phx/life_support/panel_small.mdl") then
			Price = (35 * EnergyCost) * GeneMulti  --120min
		elseif(DeviceModel == "models/props_phx/life_support/panel_medium.mdl") then
			Price = (90 * EnergyCost) * GeneMulti  --130min
		elseif(DeviceModel == "models/props_phx/life_support/panel_large.mdl") then
			Price = (250 * EnergyCost) * GeneMulti --140min
	--Normal
		elseif(DeviceModel == "models/ce_ls3additional/solar_generator/solar_generator_small.mdl") then
			Price = (30 * EnergyCost) * GeneMulti  --140min
		elseif(DeviceModel == "models/ce_ls3additional/solar_generator/solar_generator_medium.mdl") then
			Price = (50 * EnergyCost) * GeneMulti  --130min
		elseif(DeviceModel == "models/ce_ls3additional/solar_generator/solar_generator_large.mdl") then
			Price = (150 * EnergyCost) * GeneMulti  --120min
		elseif(DeviceModel == "models/ce_ls3additional/solar_generator/solar_generator_huge.mdl") then
			Price = (2300 * EnergyCost) * GeneMulti  --110min
		elseif(DeviceModel == "models/ce_ls3additional/solar_generator/solar_generator_giant.mdl") then
			Price = (32000 * EnergyCost) * GeneMulti  --100min
	--Circle
		elseif(DeviceModel == "models/ce_ls3additional/solar_generator/solar_generator_c_small.mdl") then
			Price = (65 * EnergyCost) * GeneMulti  --140min
		elseif(DeviceModel == "models/ce_ls3additional/solar_generator/solar_generator_c_medium.mdl") then
			Price = (300 * EnergyCost) * GeneMulti  --130min
		elseif(DeviceModel == "models/ce_ls3additional/solar_generator/solar_generator_c_large.mdl") then
			Price = (1100 * EnergyCost) * GeneMulti  --120min
		elseif(DeviceModel == "models/ce_ls3additional/solar_generator/solar_generator_c_huge.mdl") then
			Price = (3200 * EnergyCost) * GeneMulti  --110min
		end
	end
	
	
	if(DeviceType == "generator_energy_wind") then
		if(DeviceModel == "models/ls_models/cloudstrifexiii/windmill/windmill_small.mdl") then
			Price = (960 * EnergyCost) * GeneMulti --140min
		elseif(DeviceModel == "models/ls_models/cloudstrifexiii/windmill/windmill_medium.mdl") then
			Price = (6500 * EnergyCost) * GeneMulti --120min
		elseif(DeviceModel == "models/ls_models/cloudstrifexiii/windmill/windmill_large.mdl") then
			Price = (44000 * EnergyCost) * GeneMulti --100min
		end
	end
	
	if(DeviceType == "generator_liquid_water") then
		if(DeviceModel == "models/props_phx/life_support/gen_water.mdl") then
			Price = (400 * WaterCost) * GeneMulti --140min
		elseif(DeviceModel == "models/ce_ls3additional/water_pump/water_pump.mdl") then
			Price = (900 * WaterCost) * GeneMulti --120min
		elseif(DeviceModel == "models/chipstiks_ls3_models/LargeH2OPump/largeh2opump.mdl") then
			Price = (4000 * WaterCost) * GeneMulti --100min
		end
	end
	
	-- =================================================================================================================================== --
	-- ========================================================GENERATORS=END============================================================= --
	-- =================================================================================================================================== --
	
	
	-- =================================================================================================================================== --
	-- =========================================================STORAGE=START============================================================= --
	-- =================================================================================================================================== --
	
	-- === GAS STORAGE ===
	
	if(DeviceType == "storage_gas_o2" or
		DeviceType == "storage_gas_co2" or
		DeviceType == "storage_gas_h" or
		DeviceType == "storage_gas_n" or
		DeviceType == "storage_gas_steam" or
		DeviceType == "storage_gas") then
	--PHX Canisters
		if(DeviceModel == "models/props_phx/life_support/canister_small.mdl") then
			Price = ((5000 / 1000) * GasCost) * StorageMulti
		elseif(DeviceModel == "models/props_phx/life_support/canister_medium.mdl") then
			Price = ((8000 / 1000) * GasCost) * StorageMulti
		elseif(DeviceModel == "models/props_phx/life_support/canister_large.mdl") then
			Price = ((13000 / 1000) * GasCost) * StorageMulti
	--PHX Tanks		
		elseif(DeviceModel == "models/props_phx/life_support/tank_small.mdl") then
			Price = ((10000 / 1000) * GasCost) * StorageMulti
		elseif(DeviceModel == "models/props_phx/life_support/tank_medium.mdl") then
			Price = ((23000 / 1000) * GasCost) * StorageMulti
		elseif(DeviceModel == "models/props_phx/life_support/tank_large.mdl") then
			Price = ((50000 / 1000) * GasCost) * StorageMulti
	--CS Tanks
		elseif(
		DeviceModel == "models/chipstiks_ls3_models/SmallHydrogenTank/smallhydrogentank.mdl" or
		DeviceModel == "models/chipstiks_ls3_models/SmallCO2Tank/smallco2tank.mdl" or
		DeviceModel == "models/chipstiks_ls3_models/SmallNitrogenTank/smallnitrogentank.mdl" or
		DeviceModel == "models/chipstiks_ls3_models/SmallOxygenTank/smalloxygentank.mdl") then
			Price = ((1100 / 1000) * GasCost) * StorageMulti
		elseif(
		DeviceModel == "models/chipstiks_ls3_models/MediumHydrogenTank/mediumhydrogentank.mdl" or
		DeviceModel == "models/chipstiks_ls3_models/MediumCO2Tank/mediumco2tank.mdl" or
		DeviceModel == "models/chipstiks_ls3_models/MediumNitrogenTank/mediumnitrogentank.mdl" or
		DeviceModel == "models/chipstiks_ls3_models/MediumOxygenTank/mediumoxygentank.mdl" ) then
			Price = ((2500 / 1000) * GasCost) * StorageMulti
		elseif(
		DeviceModel == "models/chipstiks_ls3_models/LargeHydrogenTank/largehydrogentank.mdl" or
		DeviceModel == "models/chipstiks_ls3_models/LargeCO2Tank/largeco2tank.mdl" or
		DeviceModel == "models/chipstiks_ls3_models/LargeNitrogenTank/largenitrogentank.mdl" or
		DeviceModel == "models/chipstiks_ls3_models/LargeOxygenTank/largeoxygentank.mdl") then
			Price = ((15000 / 1000) * GasCost) * StorageMulti
	--CE Tanks/Canisters
		elseif(DeviceModel == "models/ce_ls3additional/canisters/canister_small.mdl") then
			Price = ((30000 / 1000) * GasCost) * StorageMulti
		elseif(DeviceModel == "models/ce_ls3additional/canisters/canister_medium.mdl") then
			Price = ((40000 / 1000) * GasCost) * StorageMulti
		elseif(DeviceModel == "models/ce_ls3additional/canisters/canister_large.mdl") then
			Price = ((50000 / 1000) * GasCost) * StorageMulti
		end
	end
	
	
	-- ==== BATTERY ====
	if(DeviceType == "storage_energy") then
	--PHX
		if(DeviceModel == "models/props_phx/life_support/battery_small.mdl") then
			Price = ((3600 / 1000) * EnergyCost) * StorageMulti
		elseif(DeviceModel == "models/props_phx/life_support/Battery_medium.mdl") then
			Price = ((9000 / 1000) * EnergyCost) * StorageMulti
		elseif(DeviceModel == "models/props_phx/life_support/battery_large.mdl") then
			Price = ((80000 / 1000) * EnergyCost) * StorageMulti
	--CE
		elseif(DeviceModel == "models/ce_ls3additional/energy_cells/energy_cell_mini.mdl") then
			Price = EnergyCost --So small its not even worth it.
		elseif(DeviceModel == "models/ce_ls3additional/energy_cells/energy_cell_small.mdl") then
			Price = ((5000 / 1000) * EnergyCost) * StorageMulti
		elseif(DeviceModel == "models/ce_ls3additional/energy_cells/energy_cell_medium.mdl") then
			Price = ((13000 / 1000) * EnergyCost) * StorageMulti
		elseif(DeviceModel == "models/ce_ls3additional/energy_cells/energy_cell_large.mdl") then
			Price = ((66000 / 1000) * EnergyCost) * StorageMulti
		elseif(DeviceModel == "models/ce_ls3additional/energy_cells/energy_cell_huge.mdl") then
			Price = ((450000 / 1000) * EnergyCost) * StorageMulti
		elseif(DeviceModel == "models/ce_ls3additional/energy_cells/energy_cell_giant.mdl") then
			Price = ((900000 / 1000) * EnergyCost) * StorageMulti
		end
	end
	
	
	-- ==== WATER/HEAVYWATER ====
	if(DeviceType == "storage_liquid_water" or DeviceType == "storage_liquid_hvywater") then
	
	--PHX Canister
		if(DeviceModel == "models/props_phx/life_support/canister_small.mdl") then
			Price = (3600 / 1000) * StorageMulti
		elseif(DeviceModel == "models/props_phx/life_support/canister_medium.mdl") then
			Price = (6000 / 1000) * StorageMulti
		elseif(DeviceModel == "models/props_phx/life_support/canister_large.mdl") then
			Price = (10000 / 1000) * StorageMulti
	--PHX Tank
		elseif(DeviceModel == "models/props_phx/life_support/tank_small.mdl") then
			Price = (8000 / 1000) * StorageMulti
		elseif(DeviceModel == "models/props_phx/life_support/tank_medium.mdl") then
			Price = (18000 / 1000) * StorageMulti
		elseif(DeviceModel == "models/props_phx/life_support/tank_large.mdl") then
			Price = (40000 / 1000) * StorageMulti
	--CE Tanks
		elseif(DeviceModel == "models/ce_ls3additional/resource_tanks/resource_tank_tiny.mdl") then
			Price = (15000 / 1000) * StorageMulti
		elseif(DeviceModel == "models/ce_ls3additional/resource_tanks/resource_tank_small.mdl") then
			Price = (45000 / 1000) * StorageMulti
		elseif(DeviceModel == "models/ce_ls3additional/resource_tanks/resource_tank_medium.mdl") then
			Price = (190000 / 1000) * StorageMulti
		elseif(DeviceModel == "models/ce_ls3additional/resource_tanks/resource_tank_large.mdl") then
			Price = (2700000 / 1000) * StorageMulti
		end
		
		
	--Check for Water or HeavyWater
		if(DeviceType == "storage_liquid_water") then
			Price = Price * WaterCost
		end
		if(DeviceType == "storage_liquid_hvywater") then
			Price = Price * HeavyWater
		end
	end
			
	-- ==== CACHE's ====		
	if(DeviceType == "storage_cache") then
		local Water, Co2, Energy, N, H, LN, HW, O2
		if(DeviceModel == "models/ce_ls3additional/resource_cache/resource_cache_small.mdl") then
			Water	= 595742
			Co2		= 744678
			Energy	= 819146
			N		= 1042549
			H		= 446807
			LN		= 1042549
			HW		= 53617
			O2		= 893614
			Price =  math.ceil((((Co2 + N + H + O2) * GasCost) + (Water * WaterCost) + (Energy * EnergyCost) + (HW * HeavyWater)) / 1000)
			
		elseif(DeviceModel == "models/ce_ls3additional/resource_cache/resource_cache_medium.mdl") then
			Water	= 1102389
			Co2		= 1377986
			Energy	= 1515785
			N		= 1929180
			H		= 826792
			LN		= 1929180
			HW		= 99215
			O2		= 1653583
			Price =  math.ceil((((Co2 + N + H + O2) * GasCost) + (Water * WaterCost) + (Energy * EnergyCost) + (HW * HeavyWater)) / 1000) * StorageMulti

		elseif(DeviceModel == "models/ce_ls3additional/resource_cache/resource_cache_large.mdl") then
			Water	= 4097036
			Co2		= 5121295
			Energy	= 5633425
			N		= 7169813
			H		= 3072777
			LN		= 7169813
			HW		= 368733
			O2		= 6145554
			Price =  math.ceil((((Co2 + N + H + O2) * GasCost) + (Water * WaterCost) + (Energy * EnergyCost) + (HW * HeavyWater)) / 1000) * StorageMulti
		
		elseif(DeviceModel == "models/LifeSupport/Storage/CargoCanister.mdl") then
			Water	= 3328949
			Co2		= 4161186
			Energy	= 4577305
			N		= 5825661
			H		= 2496712
			LN		= 5825661
			HW		= 299605
			O2		= 4993424
			Price =  math.ceil((((Co2 + N + H + O2) * GasCost) + (Water * WaterCost) + (Energy * EnergyCost) + (HW * HeavyWater)) / 1000) * StorageMulti
		end
	end
	
	
	-- ==== RESOURCE MODULES ====
	if(DeviceType == "base_default_res_module") then
		local Volume
		if(DeviceModel == "models/Spacebuild/milcock4_multipod1.mdl") then 				-- Modular Unit X-01
			Volume = 4000
		elseif(DeviceModel == "models/Slyfo/t-eng.mdl") then							-- Slyfo Tank 1
			Volume = 28000
		elseif(DeviceModel == "models/Slyfo/powercrystal.mdl") then						-- Slyfo Power Crystal
			Volume = 2000
		elseif(DeviceModel == "models/SmallBridge/Life Support/SBwallcacheS.mdl") then	-- SmallBridge, Small Wall Cache
			Volume = 100000
		elseif(DeviceModel == "models/SmallBridge/Life Support/SBwallcacheL.mdl") then	-- SmallBridge, Large Wall Cache
			Volume = 250000
		elseif(DeviceModel == "models/SmallBridge/Life Support/SBwallcacheE.mdl") then	-- SmallBridge, External Wall Cache
			Volume = 165000
		elseif(DeviceModel == "models/SmallBridge/Life Support/SBwallcacheS05.mdl") then-- SmallBridge, Small Wall Cache (half length)
			Volume = 50000
		elseif(DeviceModel == "models/SmallBridge/Life Support/SBwallcacheL05.mdl") then-- SmallBridge, Large Wall Cache (half length)
			Volume = 125000
		elseif(DeviceModel == "models/SmallBridge/Life Support/SBhullcache.mdl") then	-- SmallBridge, Hull Cache
			Volume = 1000000
		end
		Price = math.ceil(((((EnergyCost + GasCost + WaterCost) * Volume) / 1000)) * StorageMulti)
	end
	
	-- =================================================================================================================================== --
	-- =========================================================STORAGE=END=============================================================== --
	-- =================================================================================================================================== --
	
	
	-- =================================================================================================================================== --
	-- =========================================================SPECIAL=START============================================================= --
	-- =================================================================================================================================== --
	
	
	-- Suit Dispensers
	if(DeviceType == "other_dispenser") then
		if(DeviceModel == "models/props_combine/combine_emitter01.mdl") then
			Price = 10000 * EnvironMulti
		end
	end
	
	-- Air Exchagers
	if(DeviceType == "base_air_exchanger") then 
		if(DeviceModel == "models/props_combine/combine_light001a.mdl") then
			Price = 10000 * EnvironMulti
		elseif(DeviceModel == "models/props_combine/combine_light001b.mdl") then
			Price = 25000 * EnvironMulti
		end
	end
	
	-- Temp Exchagers
	if(DeviceType == "base_temperature_exchanger") then 
		if(DeviceModel == "models/props_c17/utilityconnecter006c.mdl") then
			Price = 10000 * EnvironMulti
		elseif(DeviceModel == "models/props_c17/substation_transformer01d.mdl") then
			Price = 25000 * EnvironMulti
		end
	end
	
	--ClimateControl
	if(DeviceType == "base_climate_control") then 
		if(DeviceModel == "models/props_combine/combine_generator01.mdl") then -- Normal
			Price = 250000 * EnvironMulti
		elseif(DeviceModel == "models/SmallBridge/Life Support/SBclimatereg.mdl") then -- SmallBridge
			Price = 200000 * EnvironMulti
		end
	end	

	
	-- Probes
	if(DeviceType == "other_probe") then-- Probes
		if(DeviceModel == "models/props_combine/combine_mine01.mdl") then
			Price = 5000 * EnvironMulti
		end
	end
	
	-- Gravity Regulators
	if(DeviceType == "base_gravity_control") then
		if(DeviceModel == "models/props_combine/combine_mine01.mdl") then
			Price = 5000 * EnvironMulti
		end
	end	
	
	-- Air Hydroponics
	if(DeviceType == "nature_plant") then 
		if(DeviceModel == "models/props/cs_office/plant01.mdl") then
			Price = 500 * EnvironMulti
		end
	end	
	
	
	
	-- LS Info Screens - SpecialMulti
	if(DeviceType == "other_screen") then
		if(DeviceModel == "models/SnakeSVx/s_small_screen_ls_1.mdl" or
			DeviceModel == "models/ce_ls3additional/screens/s_small_screen.mdl" or
			DeviceModel == "models/ce_ls3additional/screens/s_small_screen.mdl") then -- Tiny Screens
			Price = 100 * SpecialMulti
		elseif(DeviceModel == "models/SnakeSVx/small_screen_ls_1.mdl" or
			DeviceModel == "models/ce_ls3additional/screens/small_screen.mdl" or
			DeviceModel == "models/ce_ls3additional/screens/small_screen.mdl") then -- Small Screens
			Price = 500 * SpecialMulti
		elseif(DeviceModel == "models/SnakeSVx/medium_screen_ls_1.mdl" or
			DeviceModel == "models/ce_ls3additional/screens/medium_screen.mdl" or
			DeviceModel == "models/ce_ls3additional/screens/medium_screen.mdl") then -- Medium Screens
			Price = 1000 * SpecialMulti
		elseif(DeviceModel == "models/SnakeSVx/large_screen_ls_1.mdl" or
			DeviceModel == "models/ce_ls3additional/screens/large_screen.mdl" or
			DeviceModel == "models/ce_ls3additional/screens/large_screen.mdl") then -- Large Screens
			Price = 2000 * SpecialMulti
		end
	end
	
	-- LS Lamps
	if(DeviceType == "other_lamp") then
		if(DeviceModel == "models/props_wasteland/light_spotlight01_lamp.mdl") then
			Price = 500 * SpecialMulti
		elseif(DeviceModel == "models/props_wasteland/light_spotlight01_lamp.mdl") then
			Price = 500 * SpecialMulti
		end
	end
	
	--Terraformer
	if(DeviceType == "base_terraformer") then
		if(DeviceModel == "models/ce_ls3additional/plants/plantfull.mdl") then
			Price = 1000000 * SpecialMulti
		end
	end
	
	--Devplants
	if(DeviceType == "nature_dev_tree") then
		if(DeviceModel == "models/ce_ls3additional/plants/plantfull.mdl") then
			Price = 1000000 * SpecialMulti
		end
	end
	
	-- =================================================================================================================================== --
	-- =========================================================SPECIAL=END=============================================================== --
	-- =================================================================================================================================== --		
	
		
	-- =================================================================================================================================== --
	-- ===================================================RESOURCE=DISTRIBUTION=START===================================================== --
	-- =================================================================================================================================== --
	
	-- Resource Node
	if(DeviceType == "resource_node") then
		if(DeviceModel == "models/SnakeSVx/s_small_res_node_128.mdl") then		-- Tiny 128
			Price = 250 * ResDistMulti
		elseif(DeviceModel == "models/SnakeSVx/s_small_res_node_256.mdl") then	-- Tiny 256
			Price = 500 * ResDistMulti
		elseif(DeviceModel == "models/SnakeSVx/small_res_node.mdl") then		-- Small 512
			Price = 1000 * ResDistMulti
		elseif(DeviceModel == "models/SnakeSVx/medium_res_node.mdl") then		-- Medium 1024
			Price = 2500 * ResDistMulti
		elseif(DeviceModel == "models/SnakeSVx/large_res_node.mdl") then		-- Large 2048
			Price = 5000 * ResDistMulti
		end
	end
	
	-- Resource Valves
	if(DeviceType == "rd_ent_valve" or "rd_node_valve" or "rd_one_way_valve") then
		if(DeviceModel == "models/ResourcePump/resourcepump.mdl" or DeviceModel == "models/ce_ls3additional/resource_pump/resource_pump.mdl") then
			Price = 500 * ResDistMulti
		end
	end
	
	-- Resource Pumps
	if(DeviceType == "rd_pump") then
		if(DeviceModel == "models/ResourcePump/resourcepump.mdl") then
			Price = 250 * ResDistMulti
		elseif(DeviceModel == "models/ce_ls3additional/resource_pump/resource_pump.mdl") then
			Price = 250 * ResDistMulti
		end
	end
	
	-- =================================================================================================================================== --
	-- ===================================================RESOURCE=DISTRIBUTION=END======================================================= --
	-- =================================================================================================================================== --
	
	
	
	
	-- =================================================================================================================================== --
	-- ======================================================MINING=DEVICES=START========================================================= --
	-- =================================================================================================================================== --
	
	-- Lazors
	if(DeviceType == "mining_device_laser") then
		if(DeviceModel == "models/syncaidius/mining_laser.mdl") then
			Price = 10000 * MiningMulti
			elseif(DeviceModel == "models/syncaidius/mining_laser_m.mdl") then
			Price = 15000 * MiningMulti
			elseif(DeviceModel == "models/syncaidius/mining_laser_l.mdl") then
			Price = 20000 * MiningMulti
			elseif(DeviceModel == "models/props_trainstation/tracklight01.mdl") then
			Price = 10000 * MiningMulti
		end
	end
	
	-- Ice 2 water
	if(DeviceType == "mining_device_icer") then
		if(DeviceModel == "models/ce_ls3additional/water_pump/water_pump.mdl") then
			Price = 10000 * MiningMulti
			elseif(DeviceModel == "models/props_c17/FurnitureBoiler001a.mdl") then
			Price = 10000 * MiningMulti
		end
	end

	-- Scanner
	if(DeviceType == "mining_device_scanner") then
		if(DeviceModel == "models/props_combine/combine_mine01.mdl") then
			Price = 25000 * MiningMulti
		end
	end
	
	-- Reactor
	if(DeviceType == "mining_device_nukereactor") then
		if(DeviceModel == "models/syncaidius/uranium_reactor.mdl") then
			Price = 30000 * MiningMulti
		end
	end
	
	-- Health Dispensers
	if(DeviceType == "mining_device_dispenserhp") then
		if(DeviceModel == "models/Items/HealthKit.mdl") then
			Price = 5000 * MiningMulti
			elseif(DeviceModel == "models/props_combine/health_charger001.mdl") then
			Price = 10000 * MiningMulti
		end
	end
	
	-- Armor Dispenser
	if(DeviceType == "mining_device_dispenserarm") then
		if(DeviceModel == "models/props_combine/suit_charger001.mdl") then
			Price = 15000 * MiningMulti
		end
	end
	
	-- Rock Crushers
	if(DeviceType == "mining_device_crusher") then
		if(DeviceModel == "models/Cerus/Modbridge/Misc/Accessories/acc_furnace1.mdl") then
			Price = 10000 * MiningMulti
			elseif(DeviceModel == "models/props_industrial/oil_storage.mdl") then
			Price = 10000 * MiningMulti
		end
	end
	
	-- Rock storages
	if(DeviceType == "mining_storage_rock") then
		if(DeviceModel == "models/props_wasteland/laundry_basket001.mdl") then
			Price = 2000 * MiningMulti
			elseif(DeviceModel == "models/props_wasteland/laundry_washer001a.mdl") then
			Price = 15000 * MiningMulti
			elseif(DeviceModel == "models/Slyfo/barrel_orange.mdl") then
			Price = 1000 * MiningMulti
		end
	end
	
	-- Refinery's
	if(Price == 0 and DeviceModel == "models/syncaidius/mining_refinery.mdl") then Price = MiningRefinery(DeviceType, DeviceModel) end
	-- Mineral Storage tanks
	if(Price == 0) then Price = MiningPrice(DeviceType, DeviceModel) end
	
	-- =================================================================================================================================== --
	-- ======================================================MINING=DEVICES=END=========================================================== --
	-- =================================================================================================================================== --
	

	return Price
end

function MiningPrice(DeviceType, DeviceModel)
	local Price = 0
	local rarity = 0
	local volume = 0
	
	--Unrefined
	if(DeviceType == "mining_storage_ore_abundant")	then rarity = 1 end
	if(DeviceType == "mining_storage_ore_common")	then rarity = 2 end
	if(DeviceType == "mining_storage_ore_uncommon")	then rarity = 3 end
	if(DeviceType == "mining_storage_ore_rare")		then rarity = 4 end
	if(DeviceType == "mining_storage_ore_vrare")	then rarity = 5 end
	if(DeviceType == "mining_storage_ore_precious")	then rarity = 6 end
	
	if(DeviceModel == "models/Slyfo/t-eng.mdl")				then volume = 10000 end -- Name	= "Small Tank (Slyfo)"
	if(DeviceModel == "models/Slyfo/barrel_unrefined.mdl")	then volume = 5000 end -- Name	= "Slyfo Barrel"
	if(DeviceModel == "models/Slyfo/nacshortsleft.mdl")		then volume = 20000 end -- Name	= "Medium Tank (left, Slyfo)"
	if(DeviceModel == "models/Slyfo/nacshortsright.mdl")	then volume = 20000 end -- Name	= "Medium Tank (right, Slyfo)"
	if(DeviceModel == "models/Slyfo/nacshuttleleft.mdl")	then volume = 35000 end -- Name	= "Large Tank (Left, Slyfo)"
	if(DeviceModel == "models/Slyfo/nacshuttleright.mdl")	then volume = 35000 end -- Name	= "Large Tank (right, Slyfo)"
	
	--Refined
	if(DeviceType == "mining_storage_refined_abundant")	then rarity = 1 end
	if(DeviceType == "mining_storage_refined_common")	then rarity = 2 end
	if(DeviceType == "mining_storage_refined_uncommon")	then rarity = 3 end
	if(DeviceType == "mining_storage_refined_rare")		then rarity = 4 end
	if(DeviceType == "mining_storage_refined_vrare")	then rarity = 5 end
	if(DeviceType == "mining_storage_refined_precious")	then rarity = 6 end
	
	if(DeviceModel == "models/Slyfo/t-eng.mdl")				then volume = 10000 end -- Name	= "Small Tank (Slyfo)"
	if(DeviceModel == "models/Slyfo/barrel_refined.mdl")	then volume = 5000 end -- Name	= "Slyfo Barrel"
	if(DeviceModel == "models/Slyfo/nacshortsleft.mdl")		then volume = 20000 end -- Name	= "Medium Tank (left, Slyfo)"
	if(DeviceModel == "models/Slyfo/nacshortsright.mdl")	then volume = 20000 end -- Name	= "Medium Tank (right, Slyfo)"
	if(DeviceModel == "models/Slyfo/nacshuttleleft.mdl")	then volume = 35000 end -- Name	= "Large Tank (Left, Slyfo)"
	if(DeviceModel == "models/Slyfo/nacshuttleright.mdl")	then volume = 35000 end -- Name	= "Large Tank (right, Slyfo)"
	
	
	Price = rarity * volume
	return Price
end

function MiningRefinery(DeviceType, DeviceModel)
	local Price = 0
	local rarity = 0
	local baseprice = 5000
	
	if(DeviceType == "mining_device_ref_abundant")	then rarity = 1 end
	if(DeviceType == "mining_device_ref_common")	then rarity = 2 end
	if(DeviceType == "mining_device_ref_uncommon")	then rarity = 3 end
	if(DeviceType == "mining_device_ref_rare")		then rarity = 4 end
	if(DeviceType == "mining_device_ref_vrare")		then rarity = 5 end
	if(DeviceType == "mining_device_ref_precious")	then rarity = 6 end
	
	Price = rarity * baseprice
	return Price
end